<?php
class Myh_Plugin_Permission extends Zend_Controller_Plugin_Abstract
{
	public function preDispatch(Zend_Controller_Request_Abstract $request)
	{
		$auth = Zend_Auth::getInstance();
		$moduleName 	= $this->getRequest()->getModuleName();
		$controllerName = $this->getRequest()->getControllerName();
		if($moduleName == 'admin'){
			$flagPage = 'none';
			if($auth->hasIdentity() == false){
				$flagPage = 'login';
			}
			
			if($flagPage != 'none'){
				if($flagPage == 'login'){
					$this->_request->setModuleName('admin');
					$this->_request->setControllerName('account');
					$this->_request->setActionName('login');
				}
			}
		}
	}
}